﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace IvanString
{
    class Program
    {
        static void Main(string[] args)
        {
            int itter = AskEmailAmount();
            string a = String.Empty;
            for (int i = 0; i < itter; i++)
                Console.WriteLine(CreateEmail());
            Console.ReadKey();
        }

        static StringBuilder CreateEmail()
        {
            StringBuilder email = new StringBuilder("");
            email.Append(FirstPart().ToString());
            email.Append('@');
            email.Append(SecondPart());
            return email;
        }
        static int AskEmailAmount()
        {
            Console.WriteLine("Введите количество EMAIl");
            int emailAmount = ReadIntFromConsole();
            return emailAmount;
        }
        public static int ReadIntFromConsole()
        {
            int retVal = 0;
            bool inputIsCorrect = false;
            while (!inputIsCorrect)
            {
                try
                {
                    retVal = Int32.Parse(Console.ReadLine());
                    inputIsCorrect = true;
                    if (retVal <= 0)
                    {
                        throw new ArgumentException();
                    }
                }
                catch
                {
                    Console.WriteLine("Неправильный ввод");
                    Console.WriteLine("Повторите ввод");
                }
            }
            return retVal;
        }
        
        private static int emailNumber = 0;

        static StringBuilder FirstPart()
        {
            char[] alfabet = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
            StringBuilder fPart = new StringBuilder();
            Random number = new Random(++emailNumber + Environment.TickCount);
            for (int i = 0; i < 8; i++)
            {
               // Thread.Sleep(50);
                fPart.Append(alfabet[number.Next(0, alfabet.Length)]);
            }
            return fPart;
        }

        static string SecondPart()
        {
            string[] alfabet = { "mail.ru", "gmail.com", "inbox.ru", "i.ua" };
            Random number = new Random();
            return alfabet[number.Next(0, alfabet.Length)];
        }
    }
}
